package cn.wolfcode.trip.base.mapper;

import cn.wolfcode.trip.base.domain.User;
import cn.wolfcode.trip.base.query.QueryObject;
import org.apache.ibatis.annotations.Param;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

public interface UserMapper {
    int deleteByPrimaryKey(Long id);

    int insert(User entity);

    User selectByPrimaryKey(Long id);

    List<User> selectAll(Long uId);

    int updateByPrimaryKey(User entity);

    /**
     * 根据邮箱密码 查询有没有此用户
     * 用于登录验证
     * @param email
     * @param password
     * @return
     */
    User CheckEmailAndPassword(@Param("email") String email,
                               @Param("password")String password);

    List<User> selectForList(QueryObject qo);

    Boolean selectByCompanionId(@Param("companionId") Long companionId, @Param("uId") Long uId);


    List<User> selectByOtherUsers(@Param("privateAndCurrentUserIds") ArrayList<Long> privateAndCurrentUserIds,
                                  @Param("loginId") Long loginId);


    ArrayList<Long> selectAttentionuserId(@Param("loginId") Long loginId);

    List<User> selectByEmailAndNickName(String keyword);

    Integer selectAttention(@Param("attentionuserId") Long attentionuserId,
                            @Param("beattentionuserId") Long beattentionuserId);

    void insertAttention(@Param("attentionuserId") Long attentionuserId,
                         @Param("beattentionuserId") Long beattentionuserId);

    void deleteAttention(@Param("attentionuserId") Long attentionuserId,
                         @Param("beattentionuserId") Long beattentionuserId);

    /**
     * 查询粉丝数
     * @param id
     * @return
     */
    Integer selectcountFans(Long id);

    /**
     * 查询关注的人数
     * @return
     */
    Integer selectcounttattentions(Long id);
}